//
//  MathematicalComputation.m
//  HTMAnimations
//
//  Created by Ting Han on 2017/9/18.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "MathematicalComputation.h"

@implementation MathematicalComputation
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.strategy = [[ComputationStrategy alloc]init];
    }
    return self;
}
- (CGFloat)getValue_Y_with_X:(CGFloat)x {
    
    return [self.strategy functionWithValue:x];
}

+ (instancetype)mathematicalComputationWithStrategy:(ComputationStrategy *)strategy {
    
    MathematicalComputation *computation = [[self class] new];
    computation.strategy                 = strategy;
    
    return computation;
}

@end
